package com.jweb.framework.core.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.jweb.framework.core.ActionHolder;
import com.jweb.framework.core.Processing;

/** 
 * @author Thomas: 
 * 类说明 ：默认流程处理
 */
public class DefaultProcessing implements Processing {

	private String name ;
	private String executorName ;
	private String interceptorName ;
	private String inFieldsName ;
	private String outFieldsName ;
	private Map actionHolderMap ;
	private List actionHolderList ;
	private Map attributesMap ;
	
	/**
	 * @return the executorName
	 */
	public String getExecutorName() {
		return executorName;
	}

	/**
	 * @param executorName the executorName to set
	 */
	public void setExecutorName(String executorName) {
		this.executorName = executorName;
	}

	/**
	 * @return the interceptorName
	 */
	public String getInterceptorName() {
		return interceptorName;
	}

	/**
	 * @param interceptorName the interceptorName to set
	 */
	public void setInterceptorName(String interceptorName) {
		this.interceptorName = interceptorName;
	}

	/**
	 * @return the inFieldsName
	 */
	public String getInFieldsName() {
		return inFieldsName;
	}

	/**
	 * @param inFieldsName the inFieldsName to set
	 */
	public void setInFieldsName(String inFieldsName) {
		this.inFieldsName = inFieldsName;
	}

	/**
	 * @return the outFieldsName
	 */
	public String getOutFieldsName() {
		return outFieldsName;
	}

	/**
	 * @param outFieldsName the outFieldsName to set
	 */
	public void setOutFieldsName(String outFieldsName) {
		this.outFieldsName = outFieldsName;
	}

	/**
	 * @return the actionHolderMap
	 */
	public Map getActionHolderMap() {
		return actionHolderMap;
	}

	/**
	 * @param actionHolderMap the actionHolderMap to set
	 */
	public void setActionHolderMap(Map actionHolderMap) {
		this.actionHolderMap = actionHolderMap;
	}

	/**
	 * @return the actionHolderList
	 */
	public List getActionHolderList() {
		return actionHolderList;
	}

	/**
	 * @param actionHolderList the actionHolderList to set
	 */
	public void setActionHolderList(List actionHolderList) {
		this.actionHolderList = actionHolderList;
	}

	/**
	 * @return the attributesMap
	 */
	public Map getAttributesMap() {
		return attributesMap;
	}

	/**
	 * @param attributesMap the attributesMap to set
	 */
	public void setAttributesMap(Map attributesMap) {
		this.attributesMap = attributesMap;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	public List<ActionHolder> findActions(String s) {// s="action"
		
		return (List<ActionHolder>) this.actionHolderMap.get(s);
	}
	
	public void setJservices(List<ActionHolder> list){//"list"=ArrayList<E>-array=Object[1]--[0]=DefaultActionHolder
		this.actionHolderList = list ;
		this.actionHolderMap = new HashMap() ;
		Object obj = null ;
		ActionHolder actionHolder ;
		
		for(Iterator iterator = actionHolderList.iterator() ; iterator.hasNext() ; ((List)obj).add(actionHolder)){
			actionHolder = (ActionHolder) iterator.next();
			obj = actionHolderMap.get(actionHolder.getName());
			if(obj == null){
				obj = new ArrayList(1);
				actionHolderMap.put(actionHolder.getName(), obj);
			}
		}
	}

	public void setAttributes(Map<String,Object> map){
		this.attributesMap = map ;
	}

	public Map<String, Object> getAttributes() {
		return this.attributesMap;
	}
	
	public void setExecutor(String param){
		this.executorName = param ;
	}

	public String getExecutor() {
		return this.executorName;
	}
	
	public void setInFields(String param){
		this.inFieldsName = param ;
	}

	public String getInFields() {
		return this.inFieldsName;
	}
	
	public void setInterceptors(String param){
		this.interceptorName = param ;
	}

	public String getInterceptors() {
		return this.interceptorName ;
	}
	
	public String getName() {
		return this.name ;
	}
	
	public void setOutFields(String param){
		this.outFieldsName = param ;
	}

	public String getOutFields() {
		return this.outFieldsName ;
	}

	public String getInputFields() {
		return this.inFieldsName ;
	}

	public String getOutputFields() {
		return this.outFieldsName ;
	}
	
}
